# vim:filetype=python

@register
class wxwidget(LibExt):
    register_names = ['wx','wxgl']

    debug_suffix   = ""

    version = '2.9'

    def linux(self):
        import os
        import racy.renv as renv
        mode = 'debug' if self.debug else 'release'
        command = 'wx-config-gtk2-unicode-{0}-2.9'.format(mode)
        command = os.path.join(renv.dirs.libext,'bin',command)
        config = " ".join([
                command,
                '--libs', 'xrc', 'stc', 'richtext',
                'propgrid', 'aui', 'gl', 'html', 'qa',
                'adv', 'core', 'xml', 'net', 'base',
                '--gl-libs',
                '--cppflags',
                ])
        self.parse_configs = [config]
        self.cpppath = [('/usr','X11R6','include') ,
                        ('lib','wx','include','gtk2-unicode-debug-2.9')
                       ] 

    def darwin(self):
        if self.debug:
            self.cpppath = [('lib','wx','include','osx_carbon-unicode-debug-2.9')] 
        else:
            self.cpppath = [('lib','wx','include','osx_carbon-unicode-release-2.9')] 
        self.cpppath += [('include','wx-2.9')] 

        self.debug_suffix = 'd'

        self.libs = [
            'wx_osx_carbonu{debug}_aui-2.9',
            'wx_osx_carbonu{debug}_xrc-2.9',
            'wx_osx_carbonu{debug}_qa-2.9',
            'wx_osx_carbonu{debug}_html-2.9',
            'wx_osx_carbonu{debug}_adv-2.9',
            'wx_osx_carbonu{debug}_core-2.9',
            'wx_osx_carbonu{debug}_propgrid-2.9',
            'wx_baseu{debug}_xml-2.9',
            'wx_baseu{debug}_net-2.9',
            'wx_baseu{debug}-2.9',
            'wx_osx_carbonu{debug}_gl-2.9'
            ]

        self.frameworks = [
            'QuickTime',
            'IOKit',
            'Carbon',
            'Cocoa',
            'System',
            'AGL',
            'OpenGL',
            ]

        self.cppdefines = [
                'WXUSINGDLL',
                '_UNICODE',
                'UNICODE',
                '__WXMAC__',
                ('_FILE_OFFSET_BITS' , 64),
                '_LARGE_FILES',
                'NO_GCC_PRAGMA' 
                ]

        if self.debug:
            self.cppdefines += ['__WXDEBUG__']

    def windows(self):
        self.cppdefines = [
                'WXUSINGDLL',
                '_WINDOWS',
                '__WXMSW__',
                'WXPG_1_3',
                '_UNICODE',
                'UNICODE',
                ('xUSE_UNICODE_MSLU', '1'),
                ('wxUSE_GRAPHICS_CONTEXT', '1')  
                ]

        self.cpppath = [('lib','mswud')]

        self.debug_suffix = 'd'

        self.libs = [ 
                'wxbase29u{debug}',
                'wxbase29u{debug}_net',
                'wxbase29u{debug}_xml',
                'wxmsw29u{debug}_core',
                'wxmsw29u{debug}_adv',
                'wxmsw29u{debug}_gl',
                'wxmsw29u{debug}_aui',
                'wxmsw29u{debug}_html',
                'wxmsw29u{debug}_xrc' ,
				'wxmsw29u{debug}_propgrid'  ,
                ]
